﻿[[title="开发项目管理",pagesize="",orderby="",condition=""]]

<script language="javascript" type="text/javascript">
    var formData = ""; //缓存表单变更前的值
    function window.onload() {
        wmsCommon.setEditDivStyle("tabDiv", 0.99);

    }
    function changeWindowSize() {
        wmsCommon.setEditDivStyle("tabDiv", 0.99);
    }

    window.attachEvent('onload', pg_load);



    function pg_load() {
        //新增时带出项目分解结构
        if (wmsCommon.getQueryValue("opt") == "1") {
            var dtProjectWBS = eval(wmsCommon.execCommand(String.format("sys(#SysDictManager.GetDictItems('{0}','asc'))", "developProjectWBS")));
            for (var i = 0; i < dtProjectWBS.length; i++) {
                var tblProjectdismemberment = document.all("projectdismemberment");
                var tblRowLength = tblProjectdismemberment.rows.length;
                wmsCommon.newRow('projectdismemberment');
                var td= $(tblProjectdismemberment.rows[tblRowLength].childNodes[1]);
                   $(td.find("span input")[0]).val(dtProjectWBS[i]["value"]);
                   $(td.find("span")[0]).css("display","none");
                   $(td.find(".itemCode input")[0]).val(dtProjectWBS[i]["key"]);
                $(td.find("div")[0]).html(dtProjectWBS[i]["value"]);
            }
        } else if (wmsCommon.getQueryValue("opt") == "2") {  //修改页面更改checkbox选中状态
            var tblProjectdismemberment = document.all("projectdismemberment");
            for (var i = 1; i < tblProjectdismemberment.rows.length; i++) {
                var chkItem = tblProjectdismemberment.rows[i].childNodes[2].childNodes[0];
                var iptChk = tblProjectdismemberment.rows[i].childNodes[2].childNodes[2].childNodes[0].childNodes[0];
                chkItem.checked = (iptChk.value == "1" ? true : false);
            }
            formData = wmsCommon.getJSonDataByConfig();
        }

        //当页面加载完成后 初始化项目分解的序号
        var numL = $(".number");
        for (var i = 0; i < $(numL).length; i++) {
            $(".number").eq(i).html(i + 1);
        }

        ///更改 项目分解中 textarea的高度
        $("#tab2 textarea").css("height", 30);
          $("#tab2 textarea").css("width","98%");
        filterProjectStatus();
        hiddenUpfile();
        load_ChangeLog();
    }

    //根据checkbox选中状态给字段赋值，便于保存时的数据采集
    function changeItemChecked(ctl) {
        //debugger;
        var obj = ctl.parentNode.childNodes[2].childNodes[0].childNodes[0];
        obj.value = ctl.checked ? 1 : 0;
    }

    //根据项目类型过滤项目状态
    function filterProjectStatus() {
        var sL = $(".statusL select");
        var opL = sL.children("option");
        for (var i = 1; i < opL.length; i++) {

            if (parseInt($(opL[i]).attr("value").length) < 3) {//找出开发项目的状态
                $(opL[i]).remove();
             }
        }

    }

    ///隐藏分解项中不应该有相关文档的按钮
    function hiddenUpfile() {

         var uL = $(".upfile");
        var codeL=$(".itemCode");
        for (var i = 0; i < codeL.length; i++) {
            var code=$($(codeL[i]).find("input")[0]).val();
            if (code=="15"|| code=="25"|| code=="35"|| code=="75") {
                $(uL[i]).css("display","none");
            }
        }


    }

    //加载日志
    function load_ChangeLog() {
        var projectGUID = $($("input[id*=projectGUID]")[0]).val();
        var logL = eval(wmsCommon.execCommand(String.format("sys(#ProjectChangeLogManager.GetLogByProjectGUID('{0}'))", projectGUID)));
        var content = "";
        for (var i = 0; i < logL.length; i++) {
              content+="<tr onmouseout='wmsCommon.onMouseOut(this)' onmouseover='wmsCommon.onMouseOver(this)'><td align='center' style='width: 40px'><span>";
             content+=i+1;
             content+="</span></td> <td>";
             content+=logL[i]["changeBefore"];
             content+="</td><td>";
             content+=logL[i]["changeAfter"];
             content+="</td><td>";
             content+=logL[i]["changeColumn"];
              content+="</td><td>";
             content+=(logL[i]["changeTime"]).toLocaleString();
              content+="</td><td>";
             content+=logL[i]["executor"];
             content+="</td></tr>";
        }

        $("#tab4 table").append(content);
    }
</script>
<input type=hidden id="projectStateValue" />
<input type=hidden id="type" />
<table class="DisplayArea" id="MainTableInfo" cellpadding="0" cellspacing="0" align="center"
    style="width: 100%; height: 100%">
    <tr>
        <td class="headmiddle" style="height: 26px">
            #if($request.QueryString.get_Item("opt")=="1") <span id="LableTitle">新增开发项目</span>
            #else <span id="LableTitle2">修改开发项目</span> #end
        </td>
    </tr>
    <tr>
        <td class="centermiddle">
            <table id="contenttb" class="DisplayTable">
                <tr>
                    <td style="height: 25px; width: 80px">
                        $project.Columns.get_Item("parentGUID").DisplayName
                    </td>
                    <td style="width: 40%">
                        $project.Rows.get_Item(0).get_Item("parentGUID").Render("FocusedTextBox,checkExists=in;")
                    </td>
                    <td style="width: 80px">
                        $project.Columns.get_Item("teamCount").DisplayName
                    </td>
                    <td>
                        $project.Rows.get_Item(0).get_Item("teamCount").Render()
                    </td>
                </tr>
                <tr>
                    <td style="height: 25px; width: 80px">
                        $project.Columns.get_Item("projectName").DisplayName
                    </td>
                    <td style="width: 40%">
                        $project.Rows.get_Item(0).get_Item("projectName").Render()
                    </td>
                    <td style="width: 80px">
                        $project.Columns.get_Item("departWBS").DisplayName
                    </td>
                    <td>
                        $project.Rows.get_Item(0).get_Item("departWBS").Render()
                    </td>
                </tr>
                <tr>
                    <td style="height: 25px; width: 80px">
                        $project.Columns.get_Item("execdepartWBS").DisplayName
                    </td>
                    <td style="width: 40%">
                        $project.Rows.get_Item(0).get_Item("execdepartWBS").Render()
                    </td>
                    <td style="width: 80px">
                        $project.Columns.get_Item("projectManager").DisplayName
                    </td>
                    <td>
                        $project.Rows.get_Item(0).get_Item("projectManager").Render()
                    </td>
                </tr>
                <tr>
                    <td style="height: 25px; width: 80px">
                        $project.Columns.get_Item("lastSales").DisplayName
                    </td>
                    <td style="width: 40%">
                        $project.Rows.get_Item(0).get_Item("lastSales").Render()
                    </td>
                    <td style="width: 80px">
                        $project.Columns.get_Item("sales").DisplayName
                    </td>
                    <td>
                        $project.Rows.get_Item(0).get_Item("sales").Render()
                    </td>
                </tr>
                <tr>
                    <td style="height: 25px; width: 80px">
                        $project.Columns.get_Item("industryLineCode").DisplayName
                    </td>
                    <td style="width: 40%">
                        $project.Rows.get_Item(0).get_Item("industryLineCode").Render()
                    </td>
                     <td style="height: 25px; width: 80px">
                        $project.Columns.get_Item("costNo").DisplayName
                    </td>
                    <td style="width: 40%">
                        $project.Rows.get_Item(0).get_Item("costNo").Render()
                    </td>
                    
                    
                  
                </tr>
                <tr style="display: none" class="projectGUID">
                    <td colspan="4">
                        
                        $project.Rows.get_Item(0).get_Item("projectGUID").Render("defaultValue=$dataContext.Evaluate('sys(#CommonFunction.CreateGUID())');")
                        $project.Rows.get_Item(0).get_Item("createBy").Render("defaultValue=$session.get_Item('userNo');")
                        $project.Rows.get_Item(0).get_Item("createTime").Render("defaultValue=$dataContext.GetDate();")
                        $project.Rows.get_Item(0).get_Item("projectType").Render("defaultValue=02;")
                    </td>
                </tr>
            </table>
            <table>
                <tr>
                    <td colspan="4" valign="top">
                        <!--tab  标签列表  -->
                        <div id="first" style="margin-left: 10px">
                            <div class="on" lang="tab1" title="实施项目" align="center">
                                开发项目</div>
                            <div class="off" lang="tab2" title="项目分解" align="center">
                                项目分解</div>
                            <div class="off" lang="tab3" title="项目状态报告" align="center" style=" display:none">
                                项目技术特征</div>
                                 <div class="off" lang="tab4" title="项目变更日志" align="center" style=" width:100px;">项目变更日志</div>
                        </div>
                        <div id="tabDiv">
                            <!-- 开发项目-->
                            <div id="tab1" style="border: 1px solid #95B0CB; margin-top: 0; margin-left: 10px;
                                width: 100%">
                                <table id="Table1" border=1 class="DisplayTable">
                                    <tr>
                                        <td style="height: 25px; width: 120px">
                                            $project.Columns.get_Item("contactCode").DisplayName
                                        </td>
                                        <td style="width: 40%">
                                            $project.Rows.get_Item(0).get_Item("contactCode").Render()
                                        </td>
                                        <td style="width: 120px">
                                            $project.Columns.get_Item("contractTime").DisplayName
                                        </td>
                                        <td>
                                            $project.Rows.get_Item(0).get_Item("contractTime").Render()
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="height: 25px; width: 120px">
                                            $project.Columns.get_Item("customName").DisplayName
                                        </td>
                                        <td style="width: 40%">
                                            $project.Rows.get_Item(0).get_Item("customName").Render()
                                        </td>
                                        <td style="width: 120px">
                                            $project.Columns.get_Item("customRank").DisplayName
                                        </td>
                                        <td>
                                            $project.Rows.get_Item(0).get_Item("customRank").Render()
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="height: 25px; width: 120px">
                                            $project.Columns.get_Item("customContact").DisplayName
                                        </td>
                                        <td style="width: 40%">
                                            $project.Rows.get_Item(0).get_Item("customContact").Render()
                                        </td>
                                        <td style="width: 120px">
                                            $project.Columns.get_Item("contactPhone").DisplayName
                                        </td>
                                        <td>
                                            $project.Rows.get_Item(0).get_Item("contactPhone").Render()
                                        </td>
                                    </tr>
                                  
                                    <tr>
                                        <td style="height: 25px; width: 120px">
                                            $project.Columns.get_Item("product").DisplayName
                                        </td>
                                        <td style="width: 40%">
                                            $project.Rows.get_Item(0).get_Item("product").Render()
                                        </td>
                                        <td style="width:120px" >
                                            $project.Columns.get_Item("status").DisplayName
                                        </td>
                                        <td class="statusL">
                                            $project.Rows.get_Item(0).get_Item("status").Render()
                                        </td>
                                    </tr>
                                        <tr>
                                        <td style="height: 25px; width: 120px">
                                            $project.Columns.get_Item("isrelation").DisplayName
                                        </td>
                                        <td style="width: 40%">
                                            $project.Rows.get_Item(0).get_Item("isrelation").Render()
                                        </td>
                                        <td style="width:120px">
                                            $project.Columns.get_Item("agentName").DisplayName
                                        </td>
                                        <td>
                                            $project.Rows.get_Item(0).get_Item("agentName").Render()
                                        </td>
                                    </tr>
                                     <tr>
                                        <td style="height: 25px; width: 120px">
                                            $project.Columns.get_Item("estartTime").DisplayName
                                        </td>
                                        <td style="width: 40%">
                                            $project.Rows.get_Item(0).get_Item("estartTime").Render()
                                        </td>
                                        <td style="width: 120px">
                                            $project.Columns.get_Item("rstartTime").DisplayName
                                        </td>
                                        <td>
                                            $project.Rows.get_Item(0).get_Item("rstartTime").Render()
                                        </td>
                                    </tr>
                                     <tr>
                                        <td style="height: 25px; width: 120px">
                                            $project.Columns.get_Item("eEndTime").DisplayName
                                        </td>
                                        <td style="width: 40%">
                                            $project.Rows.get_Item(0).get_Item("eEndTime").Render()
                                        </td>
                                        <td style="width: 120px">
                                            $project.Columns.get_Item("rEndTIme").DisplayName
                                        </td>
                                        <td>
                                            $project.Rows.get_Item(0).get_Item("rEndTIme").Render()
                                        </td>
                                    </tr>
                                     <tr>
                                        <td style="height: 25px; width: 120px">
                                            $project.Columns.get_Item("EXECSTARTTIME").DisplayName
                                        </td>
                                        <td style="width: 40%">
                                            $project.Rows.get_Item(0).get_Item("EXECSTARTTIME").Render()
                                        </td>
                                        <td style="width:120px">
                                            $project.Columns.get_Item("EXECENDTIME").DisplayName
                                        </td>
                                        <td>
                                            $project.Rows.get_Item(0).get_Item("EXECENDTIME").Render()
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="height: 25px; width: 120px">
                                            $project.Columns.get_Item("RCHECKOUTTIME").DisplayName
                                        </td>
                                        <td style="width: 40%">
                                            $project.Rows.get_Item(0).get_Item("RCHECKOUTTIME").Render()
                                        </td>
                                        <td style="width:120px">
                                            $project.Columns.get_Item("ECHECKOUTTIME").DisplayName
                                        </td>
                                        <td>
                                            $project.Rows.get_Item(0).get_Item("ECHECKOUTTIME").Render()
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="height: 25px; width: 120px">
                                            $project.Columns.get_Item("researchTime").DisplayName
                                        </td>
                                        <td style="width: 40%">
                                            $project.Rows.get_Item(0).get_Item("researchTime").Render()
                                        </td>
                                        <td style="width:130px">
                                            $project.Columns.get_Item("guideTime").DisplayName
                                        </td>
                                        <td>
                                            $project.Rows.get_Item(0).get_Item("guideTime").Render()
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="height: 25px; width: 120px">
                                            $project.Columns.get_Item("ANALYSE").DisplayName
                                        </td>
                                        <td style="width: 40%">
                                            $project.Rows.get_Item(0).get_Item("ANALYSE").Render()
                                        </td>
                                        <td style="width:120px">
                                            $project.Columns.get_Item("DESIGN").DisplayName
                                        </td>
                                        <td>
                                            $project.Rows.get_Item(0).get_Item("DESIGN").Render()
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="height: 25px; width: 120px">
                                            $project.Columns.get_Item("PROGMCLOSE").DisplayName
                                        </td>
                                        <td style="width: 40%">
                                            $project.Rows.get_Item(0).get_Item("PROGMCLOSE").Render()
                                        </td>
                                        <td style="width:120px">
                                            $project.Columns.get_Item("ETESTCLOSE").DisplayName
                                        </td>
                                        <td>
                                            $project.Rows.get_Item(0).get_Item("ETESTCLOSE").Render()
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="height: 25px; width: 120px">
                                            $project.Columns.get_Item("RELEASECLOSE").DisplayName
                                        </td>
                                        <td style="width: 40%">
                                            $project.Rows.get_Item(0).get_Item("RELEASECLOSE").Render()
                                        </td>
                                        <td style="width:120px">
                                        
                                        </td>
                                        <td>
                                           
                                        </td>
                                    </tr>
                                      <tr>
                                        <td style="height: 25px; width: 80px">
                                            $project.Columns.get_Item("solveProcess").DisplayName
                                        </td>
                                        <td style="width:400px;">
                                            $project.Rows.get_Item(0).get_Item("solveProcess").Render()
                                        </td>
                                        <td></td>
                                         <td></td>
                                    </tr>
                                </table>
                                
                            </div>
                            <!-- 项目分解-->
                            <div id="tab2" class="hide" style="border: 1px solid #95B0CB; margin-top: 0; margin-left: 10px;
                                width: 100%">
                               
                                <table>
                                    <tr>
                                        <td colspan="5" style="text-align: center;">
                                        </td>
                                    </tr>
                                </table>
                                <table class="tblList" id="projectdismemberment" style="border-collapse: collapse;
                                    color: #95B0CB" border="0" rules="all" cellspacing="0">
                                    <tr>
                                        <th style="width: 30px;">
                                            <span >序号</span>
                                        </th>
                                        <th>
                                            $project.Childs.get_Item(0).Columns.get_Item("itemName").DisplayName
                                        </th>
                                        <th>
                                            完成情况
                                        </th>
                                        <th>
                                            $project.Childs.get_Item(0).Columns.get_Item("execID").DisplayName
                                        </th>
                                        <th>
                                            $project.Childs.get_Item(0).Columns.get_Item("execDesc").DisplayName
                                        </th>
                                        <th>
                                            $project.Childs.get_Item(0).Columns.get_Item("expectedTime").DisplayName
                                        </th>
                                        <th>
                                            $project.Childs.get_Item(0).Columns.get_Item("upfileGUID").DisplayName
                                        </th>
                                    </tr>
                                    #foreach($row in $project.Childs.get_Item(0).Rows) [[section:projectdismemberment{]]
                                    <tr onmouseout="wmsCommon.onMouseOut(this)" onmouseover="wmsCommon.onMouseOver(this)">
                                        <td align="center" style="width: 20px">
                                           <span class="number"></span>
                                        </td>
                                        <td width="150px">
                                            #if($request.QueryString.get_Item("opt")=="1")
                                          <span> $row.get_Item("itemName").Render()</span>
                                          <div class="itemName"></div>
                                         #else
                                         $row.get_Item("itemName")
                                         <span style="display:none">$row.get_Item("itemName").Render()</span>
                                         #end
                                            <div style="display:none" class="itemCode">$row.get_Item("itemCode").Render()</div>
                                        </td>
                                        <td style="width:50px">
                                            <input type="checkbox" onclick="changeItemChecked(this)" />
                                            <div style="display:none">$row.get_Item("itemChecked").Render("defaultValue=0;")</div>
                                        </td>
                                        <td style="width:100px">
                                            $row.get_Item("execID").Render("FocusedTextBox,checkExists=in;")
                                        </td>
                                        <td >
                                            $row.get_Item("execDesc").Render()
                                        </td>
                                        <td style="width:80px;" >
                                            $row.get_Item("expectedTime").Render()
                                        </td>
                                        <td style="text-align:center;width:80px;" class="upfile">
                                            $row.get_Item("upfileGUID").Render()
                                        </td>
                                    </tr>
                                    [[}]] #end
                                </table>
                            </div>
                            <!-- 项目技术报告-->
                            <div id="tab3" class="hide" style="border: 1px solid #95B0CB; margin-top: 0; margin-left: 10px; width: 100%; display:none;">
                                <table>
                                    <tr>
                                        <td colspan="5" style="text-align: center;">
                                            $render.RenderButton(" text=新增; displayType=button ; actionType=new;clientMethod=wmsCommon.newRow('projectStatus');")
                                            $render.RenderButton(" text=删除; displayType=button ; actionType=delete; clientMethod=DelRow('projectStatus');")
                                        </td>
                                    </tr>
                                </table>
                                <table class="tblList" id="projectStatus" style="border-collapse: collapse;
                                    color: #95B0CB" border="0" rules="all" cellspacing="0">
                                    <tr>
                                        <th style="width: 30px;">
                                            <span style="cursor: hand" onclick="wmsCommon.checkedAll('projectStatus')">选择</span>
                                        </th>
                                        <th>
                                            $project.Childs.get_Item(1).Columns.get_Item("lineBodyNumber").DisplayName
                                        </th>
                                        <th>
                                            $project.Childs.get_Item(1).Columns.get_Item("lineBodyType").DisplayName
                                        </th>
                                        <th>
                                            $project.Childs.get_Item(1).Columns.get_Item("lineBodySpeed").DisplayName
                                        </th>
                                        <th>
                                            $project.Childs.get_Item(1).Columns.get_Item("packagingForm").DisplayName
                                        </th>
                                        <th>
                                            $project.Childs.get_Item(1).Columns.get_Item("packagingLevel").DisplayName
                                        </th>
                                        <th>
                                            $project.Childs.get_Item(1).Columns.get_Item("haveTray").DisplayName
                                        </th>
                                        <th>
                                            $project.Childs.get_Item(1).Columns.get_Item("Way").DisplayName
                                        </th>
                                        <th>
                                            $project.Childs.get_Item(1).Columns.get_Item("equipmentList").DisplayName
                                        </th>
                                         <th>
                                            $project.Childs.get_Item(1).Columns.get_Item("CommunicationProtocol").DisplayName
                                        </th>
                                         <th>
                                            $project.Childs.get_Item(1).Columns.get_Item("PrintTemplate").DisplayName
                                        </th>
                                         <th>
                                            $project.Childs.get_Item(1).Columns.get_Item("Networking").DisplayName
                                        </th>
                                    </tr>
                                    #foreach($row in $project.Childs.get_Item(1).Rows) [[section:projectStatus{]]
                                    <tr onmouseout="wmsCommon.onMouseOut(this)" onmouseover="wmsCommon.onMouseOver(this)">
                                        <td align="center" style="width: 40px">
                                            <input type="checkbox" style="border: 0; cursor: hand" />
                                        </td>
                                        <td>
                                            $row.get_Item("lineBodyNumber").Render()
                                        </td>
                                        <td>
                                            $row.get_Item("lineBodyType").Render()
                                        </td>
                                        <td>
                                            $row.get_Item("lineBodySpeed").Render()
                                        </td>
                                        <td>
                                            $row.get_Item("packagingForm").Render()
                                        </td>
                                        <td>
                                            $row.get_Item("packagingLevel").Render()
                                        </td>
                                        <td>
                                            $row.get_Item("haveTray").Render()
                                        </td>
                                        <td>
                                            $row.get_Item("Way").Render()
                                        </td>
                                        <td>
                                            $row.get_Item("equipmentList").Render()
                                        </td>
                                        <td>
                                            $row.get_Item("CommunicationProtocol").Render()
                                        </td>
                                        <td>
                                            $row.get_Item("PrintTemplate").Render()
                                        </td>
                                        <td>
                                            $row.get_Item("Networking").Render()
                                        </td>
                                    </tr>
                                    [[}]] #end
                                </table>
                            </div>
                            <div id="tab4" class="hide" style="border: 1px solid #95B0CB; margin-top: 0; margin-left: 10px;
                                width: 100%">
                          
                                <table class="tblList" id="Table2" style="border-collapse: collapse;
                                    color: #95B0CB" border="0" rules="all" cellspacing="0">
                                    <tr>
                                        <th style="width: 30px;">
                                            <span>序号</span>
                                        </th>
                                        <th>
                                           变更前
                                        </th>
                                         <th>
                                           变更后
                                        </th>
                                          <th>
                                           变更操作
                                        </th>
                                          <th>
                                          变更时间
                                        </th>
                                          <th>
                                           执行人
                                        </th>
                                    </tr>
                                  
                                </table>
                            </div>
                        </div>
                    </td>
                </tr>
            </table>
            <!-- edit content end-->
        </td>
    </tr>
    <tr style="height: 20px;">
        <td colspan="4" valign="middle" style="text-align: center; height: 20px;">
            <div style="height: 20px; background-color: rgb(233, 231, 215);">
                 #if($request.QueryString.get_Item("opt")=="1")
              $render.RenderButton(" text=保存; displayType=button ; actionType=save; clientMethod=submitValidatePage();serverMethod=wmsCommon.pubSaveAndRefPage('project');")
             #else
              $render.RenderButton(" text=保存; displayType=button ; actionType=save; clientMethod=submitValidatePage();serverMethod=wmsCommon.pubSaveAndRefPage4('project','','$session.get_Item('userNo')');")
             #end
                $render.RenderButton(" text=关闭; displayType=button ; actionType=close; clientMethod=wmsCommon.closeWin();")
            </div>
        </td>
    </tr>
</table>
